package Controller;

import java.util.Scanner;

import util.TicTacToe_Exception;

import Main.main;
import Model.game;
import View.GUI;

public class MakeMoveController {
	
	GUI m;
	game g;
	
	Scanner sc;
	
	public MakeMoveController(GUI m, game g, Scanner sc){
		
		this.m=m;
		this.g=g;
		this.sc=sc;
		
		
	}
	public void process(){
		boolean moveMade=false;
		while(moveMade==false){
			System.out.println("Player"+g.currentPlayer+"It is your turn");
			System.out.println("Enter X coordinate to move");
			int x = sc.nextInt();
			System.out.println("Enter Y coordinate to move");
			int y = sc.nextInt();
			try {
				g.makeMove( x, y);
				//move made without error
				moveMade=true;
				
			} catch (TicTacToe_Exception e) {
				
				//e.printStackTrace();
				System.out.println(e.getMessage()+"Try Again");
			}
		}
		
	}
	
	
}
